<template>
  <div>
    <h1>mytest</h1>
    <p>{{ age1 }}</p>
    <p>{{ a }}</p>
    <button @click="updateAge(6)">mapmutation修改</button>
    <button @click="updateAgeAfter(3)">actions修改age</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapGetters, mapActions } from 'vuex'
export default {
  //对象形式就是为了改名 防止重复

  computed: {
    // ...mapState(['age']),
    ...mapState('user', { age1: 'age' }),
    // ...mapGetters({a:'a'})
    ...mapGetters('user', ['a'])
  },
  methods: {
    ...mapMutations('user', { updateAge: 'updateAge' }),
    // ...mapMutations(['updatestate']),
    ...mapActions('user', { updateAgeAfter: 'updateAgeAfter' })
    // ...mapActions(['updateAgeAfter'])
  }
}
</script>

<style></style>
